package common

import (
	"github.com/BurntSushi/toml"
)

type ConfigFile struct {
	Auth struct {
		JwtKey string `toml:"jwkKey"`
	}

	Logger struct {
		LogDir  string `toml:"logDir"`
		LogFile string `toml:"logFile"`
	}

	Sqlite struct {
		Path string `toml:"path"`
	}

	Server struct {
		Port int `toml:"port"`
	}

	Task struct {
		Port     int    `toml:"port"`
		Username string `toml:"username"`
		Password string `toml:"password"`
	}
}

var Config ConfigFile

func ReadConfig() {
	if _, err := toml.DecodeFile("./config.toml", &Config); err != nil {
		panic(err)
	}
}
